function Layui_SetDataTableRowColor(DivId, RowIndex, Color) {
	try {
		var div = document.getElementById(DivId);
		if (div != null) //找到对象了
		{
			var table_main = div.getElementsByClassName('layui-table-main'); //通过class获取table_main
			if (table_main != null && table_main.length > 0) {
				var table = table_main[1].getElementsByClassName('layui-table'); //通过class获取table
				if (table != null && table.length > 0) {
					var trs = table[0].querySelectorAll("tr");
					if (trs != null && trs.length > 0) {
						// trs[RowIndex].style.color = Color;//字体颜色 
						trs[RowIndex].style.backgroundColor = Color; //背景颜色
					}
					//在对应的最后一个单元格内添加 处理按钮
					   var tds  = trs[RowIndex].querySelectorAll("td");
					   if(tds != null && tds.length > 0){
					   	   var zhenggai = "<button class='layui-btn layui-btn-xs layui-bg-blue'>整改</button>";
					   	   var dingwei = "<button class='layui-btn layui-btn-xs layui-bg-blue'>定位</button>";
					   	   var chuli = "<button class='layui-btn layui-btn-xs layui-bg-blue'>处理</button>";
					   	   if (RowIndex==3){
							   tds[tds.length-1].innerHTML = dingwei +zhenggai;
						   }else{
							   tds[tds.length-1].innerHTML = dingwei +chuli ;
						   }

					   }
				}
			}

		}
	} catch (e) {
		console.log(e.message);
	}
}

layui.use('table', function() {
	var cols = [];
	$.ajax({
		url: 'http://localhost:8001/getContentList',
		type: 'get',
		success: function(data) {
			var table = layui.table;
			table.render({
				elem: '#alarmList',
				url: 'http://localhost:8001/getAlarmMessageList', //数据接口
				page: true, //开启分页
				toolbar:true,
				cols: [data],
				done: function(){
					Layui_SetDataTableRowColor('tableColor', 3, 'yellow');
					Layui_SetDataTableRowColor('tableColor', 10, 'red');
				Layui_SetDataTableRowColor('tableColor', 11, 'red');	
				}
			});
		},
	});
	console.log("11")
});



